package com.hmall.cart.listener;


import com.hmall.cart.service.ICartService;
import lombok.RequiredArgsConstructor;
import org.bouncycastle.est.CACertsResponse;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

@Component
@RequiredArgsConstructor
public class ClearCartListener {


    private final ICartService cartService;

    @RabbitListener(bindings = @QueueBinding(
            value =@Queue(name="cart.clear.queue"),
            exchange = @Exchange(name = "trade.direct"),
            key ="order.create"
    ))
    public void clearCart(HashMap<String,Object> map){
        cartService.removeByMapd(map);
    }
}
